<?php
/**
 * Log
 * @filesource
 */
/**
 * Namespace
 */
namespace framework\library;
/**
 * Defines
 */
define('DEFAULT_LOG', 'error.txt');
define('LOGS_DIR', dirname(dirname(__FILE__)) . '/logs/');
/**
 * Dependencies
 */
/**
 * Log Class
 * 
 * @todo Finish Documentation
 *
 * @author Randy Casburn <randy@plurious.com>
 * @copyright Copyright Plurious Software, all rights reserved
 * @license MIT
 * @license http://www.opensource.org/licenses/mit-license.html
 * @link http://plurious.com/framework/documentation/classes/Front.html
 * @version 2.1
 */
class Log {

    public static $logDir;
    public static $log = 'log.txt';

    public function __construct($log = 'error.txt', $logDir = false) {
        self::$log = $log;
        self::$logDir = (!$logDir)? FRAMEWORK_DIR .'data/logs/' : $logDir;
    }

    /**
     * Appends log messages to the log file
     * 
     * @param string $message To append to the log file
     */
    public static function write($message) {
        file_put_contents(self::$logDir . self::$log, date('Y-m-d G:i:s') . ' - ' . $message . "\n", FILE_APPEND);
    }

    public function setLogDir($logDir) {
        self::$logDir = $logDir;
    }

    public function setLog($log) {
        self::$log = $log;
    }

}

?>